const db = require('../../database')

module.exports = function checkName(req, res) {
    const username = req.query['username'];
    const sql = 'select username from users where username = ?';
    db.query(sql, username, (err, data) => {
        if (err) return res.cc(err);
        if (data.length > 0) {
            return res.cc('name existed');
        }
        res.cc('name not existed', 0)
    })
}